package api

import (
	metrics "multitude-cloud-exporter/pkg/resource/common"
	"net/http"

	"github.com/gin-gonic/gin"
	"github.com/prometheus/client_golang/prometheus/promhttp"
)

func InitRouter(Router *gin.Engine) {
	//健康检测
	Router.GET("/health", func(c *gin.Context) {
		c.JSON(http.StatusOK, gin.H{
			"ok": true,
		})
	})

	//Metrics
	Router.GET("/metrics", func(c *gin.Context) {
		promhttp.HandlerFor(metrics.DefaultRegistry,
			promhttp.HandlerOpts{}).
			ServeHTTP(c.Writer, c.Request)
	})

	rg := Router.Group("/resource")
	a := new(Api)
	rg.GET("/metrics", a.GetResourceMetrics())
}
